#include "InputDialog.h"
#include "ui_InputDialog.h"

InputDialog::InputDialog(QWidget *parent) :
	QDialog(parent),
	ui(new Ui::InputDialog)
{
	ui->setupUi(this);

	connect(ui->plainTextEdit, SIGNAL(textChanged()), this, SLOT(updateCount()));
}

InputDialog::~InputDialog()
{
	delete ui;
}

QString InputDialog::text() const
{
	return ui->plainTextEdit->toPlainText();
}

void InputDialog::updateCount()
{
	ui->countLabel->setText(QString("%1/150").arg(text().size()));
}

void InputDialog::changeEvent(QEvent *e)
{
	QDialog::changeEvent(e);
	switch (e->type()) {
	case QEvent::LanguageChange:
		ui->retranslateUi(this);
		break;
	default:
		break;
	}
}
